home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Environments / Clean 1.2.4 / MacInterface / files.icl < prev    next >
Encoding:
Modula Implementation  |  1997-01-15  |  7.9 KB  |  210 lines  |  [TEXT/3PRM]

  1. implementation module files;
  2.  
  3. import mac_types;
  4.  
  5. GetVInfo :: !{#Char} !Toolbox -> (!Int,!Int,!Toolbox);
  6. GetVInfo ioNamePtr t
  7.     =    (a,b,NewToolbox);
  8.     where {
  9.         (a,b) = GetVInfo` ioNamePtr t;
  10.     };
  11.  
  12. GetVInfo` :: !{#Char} !Toolbox -> (!Int,!Int);
  13. GetVInfo` ioNamePtr t = code (ioNamePtr=A0,t=U)(ioResult=D1,ioVRefNum=D0){
  14.     instruction 0x4FEF 0xFFA0                ||    lea     -64(sp),sp
  15.     instruction 0x42AF 0x000C                ||    clr.l    12(sp)
  16.     instruction 0x5E88                        ||    addq.l    #7,a0
  17.     instruction 0x2F48 0x0012                ||    move.l    a0,18(sp)
  18.     instruction 0x426F 0x0016                ||    clr.w    22(sp)
  19.     instruction 0x3F7C 0xFFFF 0x001C        ||    move.w    #-1,28(sp)
  20.     instruction 0x204F                        ||    move.l    sp,a0
  21.     instruction 0xA007                        ||    dc.w    $A007    ;    _GetVolInfo
  22.     instruction 0x48C0                        ||    ext.l    d0
  23.     instruction 0x2200                        ||    move.l    d0,d1
  24.     instruction 0x302F 0x0016                ||    move.w    22(sp),d0
  25.     instruction 0x48C0                        ||    ext.l    d0
  26.     instruction 0x4FEF 0x0060                ||    lea        64(sp),sp
  27. };
  28.  
  29. GetCatInfo1 :: !Int !{#Char} !Toolbox -> (!Int,!Int,!Toolbox);
  30. GetCatInfo1 ioVRefNum ioNamePtr t
  31.     =    (a,b,NewToolbox);
  32.     where {
  33.         (a,b) = GetCatInfo1` ioVRefNum ioNamePtr t;
  34.     };
  35.  
  36. GetCatInfo1` :: !Int !{#Char} !Toolbox -> (!Int,!Int);
  37. GetCatInfo1` ioVRefNum ioNamePtr t = code (ioVRefNum=D1,ioNamePtr=A0,t=U)(ioResult=D1,ioDrParID=D0){
  38.     instruction 0x4FEF 0xFF94    ||    lea -108(sp),sp
  39.     instruction 0x42AF 0x000C    ||    clr.l    12(sp)
  40.     instruction 0x5E88            ||    addq.l    #7,a0
  41.     instruction 0x2F48 0x0012    ||    move.l    a0,18(sp)
  42.     instruction 0x3F41 0x0016    ||    move.w    d1,22(sp)
  43.     instruction 0x426F 0x001C    ||    clr.w    28(sp)
  44.     instruction 0x42AF 0x0030    ||    clr.l    48(sp)
  45.     instruction 0x204F            ||    move.l    sp,a0
  46.     instruction 0x7009            ||    MOVEQ    #9,D0
  47.     instruction 0xA260            ||    DC.W    $A200+96
  48.     instruction 0x48C0            ||    ext.l    d0
  49.     instruction 0x2200            ||    move.l    d0,d1
  50.     instruction 0x202F 0x0064    ||    move.l    100(sp),d0
  51.     instruction 0x4FEF 0x006C    ||    lea 108(sp),sp
  52. };
  53.  
  54. GetCatInfo2 :: !Int !Int !{#Char} !Toolbox -> (!Int,!{#Char},!Int,!Toolbox);
  55. GetCatInfo2 ioVRefNum ioDrDirID s t
  56.     =    (a,b,c,NewToolbox);
  57.     where {
  58.         (a,b,c) = GetCatInfo2` ioVRefNum ioDrDirID s t;
  59.     };
  60.  
  61. GetCatInfo2` :: !Int !Int !{#Char} !Toolbox -> (!Int,!{#Char},!Int);
  62. GetCatInfo2` ioVRefNum ioDrDirID s t = code (ioVRefNum=D2,ioDrDirID=D1,s=A0,t=U)(ioResult=D1,ioDrParID=D0,ioNamePtr=A0){
  63.     instruction 0x4FEF 0xFF94            ||    lea -108(sp),sp
  64.     instruction 0x42AF 0x000C            ||    clr.l    12(sp)
  65.     instruction 0x2C08                    ||    move.l    a0,d6
  66.     instruction 0x42A8 0x0004            ||    clr.l    4(a0)
  67.     instruction 0x5E88                    ||    addq.l    #7,a0
  68.     instruction 0x2F48 0x0012            ||    move.l    a0,18(sp)
  69.     instruction 0x3F42 0x0016            ||    move.w    d2,22(sp)
  70.     instruction 0x3F7C 0xFFFF 0x001C    ||    move.w    #-1,28(sp)
  71.     instruction 0x2F41 0x0030            ||    move.l    d1,48(sp)
  72.     instruction 0x204F                    ||    move.l    sp,a0
  73.     instruction 0x7009                    ||    MOVEQ    #9,D0
  74.     instruction 0xA260                    ||    DC.W    $A200+96
  75.     instruction 0x48C0                    ||    ext.l    d0
  76.     instruction 0x2200                    ||    move.l    d0,d1
  77.     instruction 0x202F 0x0064            ||    move.l    100(sp),d0
  78.     instruction 0x2046                    ||    move.l    d6,a0
  79.     instruction 0x4FEF 0x006C            ||    lea 108(sp),sp
  80. };
  81.  
  82. GetCatInfo3 :: !Int !Int !{#Char} !Toolbox -> (!Int,!Int,!Int,!Toolbox);
  83. GetCatInfo3 ioVRefNum ioDirID ioNamePtr t
  84.     =    (a,b,c,NewToolbox);
  85.     where {
  86.         (a,b,c) = GetCatInfo3` ioVRefNum ioDirID ioNamePtr t;
  87.     };
  88.  
  89. GetCatInfo3` :: !Int !Int !{#Char} !Toolbox -> (!Int,!Int,!Int);
  90. GetCatInfo3` ioVRefNum ioDirID ioNamePtr t = code (ioVRefNum=D2,ioDirID=D1,ioNamePtr=A0,t=U)(ioResult=D2,ioFlAttrib=D1,ioDrDirID=D0){
  91.     instruction 0x4FEF 0xFF94    ||    lea -108(sp),sp
  92.     instruction 0x42AF 0x000C    ||    clr.l    12(sp)
  93.     instruction 0x5E88            ||    addq.l    #7,a0
  94.     instruction 0x2F48 0x0012    ||    move.l    a0,18(sp)
  95.     instruction 0x3F42 0x0016    ||    move.w    d2,22(sp)
  96.     instruction 0x426F 0x001C    ||    clr.w    28(sp)
  97.     instruction 0x2F41 0x0030    ||    move.l    d1,48(sp)
  98.     instruction 0x204F            ||    move.l    sp,a0
  99.     instruction 0x7009            ||    MOVEQ    #9,D0
  100.     instruction 0xA260            ||    DC.W    $A200+96
  101.     instruction 0x48C0            ||    ext.l    d0
  102.     instruction 0x2400            ||    move.l    d0,d2
  103.     instruction    0x7200            ||    moveq    #0,d1
  104.     instruction 0x122F 0x001E    ||    move.b    30(sp),d1
  105.     instruction 0x202F 0x0030    ||    move.l    48(sp),d0
  106.     instruction 0x4FEF 0x006C    ||    lea 108(sp),sp
  107. };
  108.  
  109. GetWDInfo :: !Int !Toolbox -> (!Int,!Int,!Int,!Toolbox);
  110. GetWDInfo ioVRefNum t
  111.     =    (a,b,c,NewToolbox);
  112.     where {
  113.         (a,b,c) = GetWDInfo` ioVRefNum t;
  114.     };
  115.  
  116. GetWDInfo` :: !Int !Toolbox -> (!Int,!Int,!Int);
  117. GetWDInfo` ioVRefNum t = code (ioVRefNum=D1,t=U)(ioResult=D2,ioWDVRefNum=D1,ioWDDirId=D0){
  118.     instruction 0x4FEF    0xFFCC    ||    lea -52(sp),sp
  119.     instruction 0x42AF    0x000C    ||    clr.l    12(sp)
  120.     instruction 0x42AF    0x0012    ||    clr.l    18(sp)
  121.     instruction 0x3F41    0x0016    ||    move.w    d1,22(sp)
  122.     instruction 0x426F    0x001A    ||    clr.w    26(sp)
  123.     instruction 0x204F            ||    move.l    sp,a0
  124.     instruction 0x7007            ||    MOVEQ    #7,D0
  125.     instruction 0xA260            ||    DC.W    $A200+96
  126.     instruction 0x48C0            ||    ext.l    d0
  127.     instruction 0x2400            ||    move.l    d0,d2
  128.     instruction 0x322F    0x0016    ||    move.w    22(sp),d1
  129.     instruction 0x48C1            ||    ext.l    d1
  130.     instruction 0x202F    0x0030    ||    move.l    48(sp),d0
  131.     instruction 0x4FEF    0x0034    ||    lea 52(sp),sp
  132. };
  133.  
  134. HGetVol :: !Toolbox -> (!Int,!Int,!Int,!Toolbox);
  135. HGetVol t = (0,0,0,t);
  136.  
  137. OpenWD :: !Int !Int !Toolbox -> (!Int,!Toolbox);
  138. OpenWD ioVRefNum ioWDDirID t = (OpenWD` ioVRefNum ioWDDirID t, NewToolbox);
  139.  
  140. OpenWD` :: !Int !Int !Toolbox -> Int;
  141. OpenWD` ioVRefNum ioWDDirID t = code (ioVRefNum=D2,ioWDDirID=D1,t=U)(ioWDVRefNum=D0){
  142.     instruction 0x4FEF    0xFFCC    ||    lea -52(sp),sp
  143.     instruction 0x42AF    0x000C    ||    clr.l    12(sp)
  144.     instruction 0x42AF    0x0012    ||    clr.l    18(sp)
  145.     instruction 0x3F42    0x0016    ||    move.w    d2,22(sp)
  146.     instruction 0x42AF    0x001C    ||    clr.l    28(sp)
  147.     instruction 0x2F41    0x0030    ||    move.l    d1,48(sp)
  148.     instruction 0x204F            ||    move.l    sp,a0
  149.     instruction 0x7001            ||    MOVEQ    #1,D0
  150.     instruction 0xa9ff
  151.     instruction 0xA260            ||    DC.W    $A200+96
  152.     instruction 0x302F    0x0016    ||    move.w    22(sp),d0
  153.     instruction 0x48C0            ||    ext.l    d0
  154.     instruction 0x4FEF    0x0034    ||    lea 52(sp),sp
  155. };
  156.  
  157. GetFInfo :: !{#Char} !Toolbox -> (!Int,!Int,!Toolbox);
  158. GetFInfo ioNamePtr t = (ioResult,ioDate_and_Time,NewToolbox);
  159.     where {
  160.         (ioResult,ioDate_and_Time) = GetFInfo` ioNamePtr t;
  161.     };
  162.  
  163. GetFInfo` :: !{#Char} !Toolbox -> (!Int,!Int);
  164. GetFInfo` ioNamePtr t = code (ioNamePtr=A0,t=U)(ioResult=D1,ioDate_and_Time=D0){
  165.     instruction 0x4FEF 0xFFB0                ||    lea     -80(sp),sp
  166.     instruction 0x42AF 0x000C                ||    clr.l    12(sp)
  167.     instruction 0x5E88                        ||    addq.l    #7,a0
  168.     instruction 0x2F48 0x0012                ||    move.l    a0,18(sp)
  169.     instruction 0x426F 0x0016                ||    clr.w    22(sp)
  170.     instruction 0x426F 0x001A                ||    clr.w    26(sp)
  171.     instruction 0x3F7C 0xFFFF 0x001C        ||    move.w    #-1,28(sp)
  172.     instruction 0x42AF 0x0030                ||    clr.l    48(sp)    
  173.     instruction 0x204F                        ||    move.l    sp,a0
  174.     instruction 0xA20C                        ||    dc.w    0xA20C    ;    _HGetFInfo
  175.     instruction 0x48C0                        ||    ext.l    d0
  176.     instruction 0x2200                        ||    move.l    d0,d1
  177.     instruction 0x202F 0x004C                ||    move.l    76(sp),d0
  178.     instruction 0x4FEF 0x0050                ||    lea        80(sp),sp
  179. };
  180.  
  181. SetFileTypeAndCreator :: !{#Char} !{#Char} !{#Char} !Toolbox -> (!Int,!Toolbox);
  182. SetFileTypeAndCreator type creator ioNamePtr t = code (ioNamePtr=A0,t=U)(ioResult=D1,t2=Z){
  183.     instruction 0x2A2A 0x0008                ||    move.l    8(a2),d5
  184.     instruction 0x2829 0x0008                ||    move.l    8(a1),d4
  185.     instruction 0x4FEF 0xFFB0                ||    lea     -80(sp),sp
  186.     instruction 0x42AF 0x000C                ||    clr.l    12(sp)
  187.     instruction 0x5E88                        ||    addq.l    #7,a0
  188.     instruction 0x2608                        ||    move.l    a0,d3
  189.     instruction 0x2F48 0x0012                ||    move.l    a0,18(sp)
  190.     instruction 0x426F 0x0016                ||    clr.w    22(sp)
  191.     instruction 0x426F 0x001A                ||    clr.w    26(sp)
  192.     instruction 0x3F7C 0xFFFF 0x001C        ||    move.w    #-1,28(sp)
  193.     instruction 0x42AF 0x0030                ||    clr.l    48(sp)    
  194.     instruction 0x204F                        ||    move.l    sp,a0
  195.     instruction 0xA20C                        ||    dc.w    0xA20C    ;    _HGetFInfo
  196.     instruction 0x48C0                        ||    ext.l    d0
  197.     instruction 0x6612                        ||    bne.s    l1
  198.     instruction 0x2F43 0x0012                ||    move.l    d3,18(sp)
  199.     instruction 0x2F45 0x0020                ||    move.l    d5,32(sp)
  200.     instruction 0x2F44 0x0024                ||    move.l    d4,36(sp)
  201.     instruction 0x42AF 0x0030                ||    clr.l    48(sp)    
  202.     instruction 0xA20D                        ||    dc.w    0xA20D    ;    _HSetFInfo
  203.     instruction 0x48C0                        ||    l1: ext.l    d0
  204.     instruction 0x2200                        ||    move.l    d0,d1
  205.     instruction 0x4FEF 0x0050                ||    lea        80(sp),sp
  206. };
  207.  
  208. LaunchApplication :: !{#Char} !Int !Toolbox -> (!Int,!Toolbox);
  209. LaunchApplication s flags t = (0,t);
  210.